package com.glsc.ngateway.filetransfer.config;

import com.github.benmanes.caffeine.cache.stats.CacheStats;
import com.github.benmanes.caffeine.cache.stats.StatsCounter;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;

@Component
public class CacheStatsCounter implements StatsCounter {

    Logger logger = LoggerFactory.getLogger(CacheStatsCounter.class);

    @Override
    public void recordHits(int i) {
        logger.info("命中次数：" + i);
    }

    @Override
    public void recordMisses(int i) {
        logger.info("未命中次数：" + i);
    }

    @Override
    public void recordLoadSuccess(long l) {
        logger.info("加载成功次数：" + l);
    }

    @Override
    public void recordLoadFailure(long l) {
        logger.info("加载失败次数：" + l);
    }

    @Override
    public void recordEviction() {
        logger.info("因为缓存大小限制，执行了一次缓存清除工作");
    }

    @Override
    public void recordEviction(int weight) {
        logger.info("因为缓存权重限制，执行了一次缓存清除工作，清除的数据的权重为：" + weight);
    }

    @Override
    public CacheStats snapshot() {
        return null;
    }
}

